/*
 * Required field validator
 *  
 * Copyright (C) 2011 Antti Leppä / Otavan Opisto
 * http://www.otavanopisto.fi
 * 
 * License: 
 * 
 * Licensed under GNU Lesser General Public License Version 3 or later (the "LGPL") 
 * http://www.gnu.org/licenses/lgpl.html
 */
fi.internetix.validation.validator.RequiredFieldValidator = Class.create(fi.internetix.validation.FieldValidator,
  /** @lends fi.internetix.validation.validator.RequiredFieldValidator# **/   
  {
  /**
  * Class constructor
  * @class Constructs this class
  * @extends fi.internetix.validation.FieldValidator
  * @constructs
  * @param $super super class 
  */
  initialize : function($super) {
    $super();
  },
  validate: function ($super, field) {
    return this._getFieldValue(field).blank() ? fi.internetix.validation.FieldValidator.STATUS_INVALID : fi.internetix.validation.FieldValidator.STATUS_VALID;
  },
  getType: function ($super) {
    return fi.internetix.validation.FieldValidator.TYPE_MANDATORY;
  },
  getClassName: function () {
    return 'required';
  }
});

fi.internetix.validation.FieldValidatorVault.registerValidator(new fi.internetix.validation.validator.RequiredFieldValidator());